package org.happycomp.radiog.core;

import java.util.Date;

import org.happycomp.radio.StopDownloadCondition;


public class StopTimeCondition implements StopDownloadCondition {

	private Date stopDate;
	private boolean manualStop;
	
	public StopTimeCondition() {
	}
	
	public StopTimeCondition(Date stopDate) {
		super();
		this.stopDate = stopDate;
	}

	@Override
	public boolean isStopped() {
		if (this.manualStop) return true;
		return new Date().after(this.stopDate);
	}

	@Override
	public void manualStop() {
		this.manualStop = true;
	}
	
	public Date getStopDate() {
		return this.stopDate;
	}

	@Override
	public void initFromStopDate(Date arg0, Date arg1) {
		this.stopDate = arg1;
	}

	@Override
	public Date storeToStopDate(Date arg0) {
		return this.stopDate;
	}
	
	
}
